<?php
	
	
	
	
	$mysql_server = "192.168.0.4"; 
	$mysql_login =  "support"; 
	$mysql_password = "vanilla"; 
	
	if (!isset($_GET["id"])) {
		echo "\n<BR><B><FONT color=\"#FF0000\">Invalid Input </FONT></B>";
		echo "\n<BR><b>Usage:</b> getadd.php?id=&lt;imageid&gt;";
		exit();
		
	} else {
		$id = (int) $_GET["id"]; 
		
		if ($id == "") {
			echo "\n<BR><B><FONT color=\"#FF0000\">Invalid Input </FONT></B>";
			echo "\n<BR><b>Usage:</b> getadd.php?id=&lt;imageid&gt;";
			exit();
		}
		
		$link = mysql_connect($mysql_server, $mysql_login, $mysql_password); // connect to mysql server
		
		if (!$link) {
			die('<BR>Could not connect: ' . mysql_error());
		}

		$db_selected = mysql_select_db("maga"); // select image database
		
		if (!$db_selected) {
			die ('<BR>Can\'t use database : ' . mysql_error());
		}


		$sql  = "SELECT (adv_data) from advertisemnt_add where adv_id=$id";
		
		
		$result = mysql_query($sql);
		
		if (!$result) {
			echo "\n<BR>Could not successfully run query ($sql) from database: " . mysql_error();
			exit;
		}
	
		if (mysql_num_rows($result) == 0) {
			echo "\n<BR>No data found, nothing to display";
			exit;
		}

		while ($row = mysql_fetch_assoc($result)) {
			//$mime =  $row["image_type"];
			$data =  $row["adv_data"]; 

		mysql_free_result($result); 

		//Header( "Content-type: $mime"); 
		echo $data; 
		mysql_close($link); 
		exit();
	}
	}
?>